export const common = {
    activated() {
        if(this.isFinish){
            this.checkPermissionState()
        }else{
            console.log('props丢失');
            this.checkPermissionState()
        }
    },
    methods: {
        updateStorageLimitSpace(id,amount,flag){
            const query = this.$Bmob.Query('wareHouse')
            return query.get(id).then(res => {
                res.increment('upperlimit',flag==='1'?amount:-amount)
                res.save()
            }).catch(err=>{
                console.log(err);
            })
        },
        updateStockAmount(id,amount,flag){
            const query = this.$Bmob.Query('Stock')
            return query.get(id).then(res => {
                res.increment('amount',flag==='1'?amount:-amount)
                res.save()
            }).catch(err=>{
                console.log(err);
            })
        }
    },
}